<?php
	include(ROOTPATH .'include'. DS .'protect.php');
	include(ROOTPATH .'include'. DS .'initUser.php');
	if( $isUserExist )
		$title = $userInfo['nickName'] .'('. $userInfo['userName'] .') '.lang_user_home;
	else
		$title = '此用户不存在 -- 用户首页';
	include "header.php";

	
?>
<?php /*?><script type="text/javascript" src="<?php echo JSLAB_PATH;?>beautyStyle/js/beautyStyle.js"></script>
<link href="<?php echo JSLAB_PATH;?>beautyStyle/images/beautyStyle.css" type="text/css" rel="stylesheet" media="all" /><?php */?>
<?php 
	$userEmail = explode('@',$userInfo['userName']);
?>
<script type="text/javascript">
var userEmailPrev = '<?php echo htmlShow($userEmail[0]); ?>';
var userEmailNext = '<?php echo htmlShow($userEmail[1]); ?>';
</script>
<script type="text/javascript" src="<?php echo JS_PATH;?>home.js"></script>

</head>
<body>
	<?php require('top.php');  ?>

<div class="pos">
	<div class="contents">
    	<?php require('nav.php'); ?>   
        <h2 class="title"><?php echo $navigation -> getList();?><?php echo htmlShow($userInfo['nickName']) .' '. lang_user_home;?>         
        <?php if( $isMyhome && $isUserExist ){?>
        	<span><a href="<?php  echo urlRewrite('option=homeEdit')?>"><?php echo lang_edit_user_info;?></a><a href="<?php  echo urlRewrite('option=homeEditAccoun')?>"><?php echo lang_edit_user_account;?></a></span>
        <?php }?>
        </h2>
        <div id="home" class="home">
        	<div class="userInfo">        
                <div class="baseInfo">
                	<div class="userFace"><span class="beautyImg"><img src="<?php
						echo getFace($id,'big');						
					?>" /></span></div>
                    <ul>
                    	<li><strong><?php echo htmlShow($userInfo['nickName']); ?></strong></li>
                        <li class="nickName" id="userNameShow"><strong></strong></li>
                        <li><?php echo lang_works_amount;?>：<?php echo $fileCount ;?></li>
                        <li><?php echo lang_works_quality;?>：<span class="star"><?php 
							$list = $dbs -> select('SELECT AVG(`star`) as `stars` FROM `'.DB_PRE.'file` WHERE `user_id` = '. $user -> id() );
							$stars = (int)$list[0]['stars'];
							
							$starHtml = '';
							for($i = 1; $i <= 5 ; $i++){
								$class = $i <= $stars ? ' class="a" ' : '';
								$starHtml .= '<i'.$class.'></i>';
							}
							echo $starHtml ;
			
						?></span></li>
                    </ul>
                    <div class="clear"></div>
                </div>
                
                <hr />
                <h3 class="highBig"><?php echo lang_personal_description;?></h3>
                <h3><?php
				 if( '' != $userInfo['description'] )
				 	echo htmlShow($userInfo['description']);
				else{ ?>                
					<?php if( $isMyhome && $isUserExist ){ ?>
                    <?php echo lang_null_personal_description;?>，<a href="<?php echo urlRewrite('option=homeEdit')?>"><?php echo lang_click_and_upload;?></a>
                    <?php }else if( !$isUserExist ){
						echo '此用户不存在';
					}
				}?>
                </h3>
            </div><!-- .userInfo -->
            
            <div class="userFileList topLists">
            <h3 class="highBig portfolioListTitle"><?php echo lang_works_show;?></h3>
            <ul>
			<?php
            	$mediaFile = new mediaFile();
				$lists = $mediaFile -> getUserFileList($id,'id',$num = 6, $isPage = false,$isMore = true);
				if( strlen($lists) > 30)
					echo $lists;
				else{ ?>                
					<?php if( $isMyhome && $isUserExist ){?>
                    <?php echo lang_null_works;?>，<a href="<?php echo urlRewrite('option=creatMedia')?>"><?php echo lang_click_and_upload;?></a>
                    <?php }else if( !$isUserExist ){
						echo '此用户不存在';
					}
				}?>
            </ul>
            </div>
            <div class="clear"></div>
        </div><!--#home-->
	</div><!-- .contents-->
</div>

<?php include(ROOTPATH .'templates'. DS .'footer.php'); ?>



</body>
</html>
